Skip to main content

All Questions

4votes
2answers
110views

Custom RowSorter that sorts a Swing table containing data with unit suffixes

I would like to hear what you say about my custom RowSorter implementation. The following comparators should be used for the table columns: String, Double and Integer. The table data has postfixes and ...
Tobias Grothe's user avatar
2votes
1answer
85views

Implementing an improved merge sort that uses insertion sort, with "levels" - Would this work correctly?

We were asked to improve the merge sort algorithm by introducing insertion sort to the code. We have been tasked with doing this by utilising a "levels" logic. Here is the exact description ...
Preatorius's user avatar
2votes
2answers
193views

Quick Sort Program

Quick sort is a sorting algorithm in which we select any random element as pivot from the array and we do the partition of the array around that pivot. Basically we place all the elements smaller than ...
Strange Alchemist's user avatar
2votes
0answers
63views

Construction of external sorts from comparison ones

Here's an example how to construct an external sorting algorithm from the Quicksort. The method may be applicable to other known internal comparison sort algorithms. I have checked that it shows N*...
Skrabák Csaba's user avatar
0votes
2answers
144views

ContactsList implementation in Java

I created a ContactsList class in Java that holds Person objects. I consider this is a side project for my GitHub profile. Any ...
Hamidur Rahman's user avatar
3votes
3answers
221views

String comparator as a lambda

I am writing a Comparator for my TreeMap. It looks like this: ...
Superluminal's user avatar
1vote
2answers
95views

Mergesort, instrumented for counting reads and writes

I have just finished an implementation of mergesort, and I was wondering if I can further reduce the amount of reads and writes. I have looked at it for a while, and to my eyes, I cannot see anything ...
joeyvanlierop's user avatar
1vote
1answer
205views

Custom sorting algo / optimized bubble sort

I'm a novice and started diving into data structures and algorithms recently. I was taught bubble sort recently and I found that the original bubble sort algorithm is so inefficient, so I wrote a ...
SandyG's user avatar
2votes
2answers
364views

Radix sort implementation

I have a problem where I need to sort an extremely large number of numbers but the numbers are in a narrow range (0..r-1) where r is typically around 10, and after googling around a bit it seemed like ...
user3079275's user avatar
12votes
3answers
6kviews

Natural Order Comparator

I've been looking for an implementation of Comparator that provides a "natural order". I found a couple but they were buggy or poorly designed. I wrote my own with ...
NonlinearFruit's user avatar
1vote
1answer
2kviews

Closest Numbers

Online coding challenge Hacker Rank. Given a list of unsorted integers, find the pair of elements that have the smallest absolute difference between them? If there are multiple pairs, find them all. <...
CodeYogi's user avatar
1vote
1answer
152views

Sort by year and day descending, yet time ascending

I recently discovered a hugely inefficient portion of code in my program, and have gone about rewriting it. I am however, not quite sure if the rewritten program actually does exactly what I want, due ...
Daniël van den Berg's user avatar
4votes
2answers
2kviews

Sort array of Numbers with some values always first

The first number will be dynamically selected and remaining array should be sorted ascending ...
Rajesh's user avatar
4votes
1answer
75views

Generating, segregating, merging, and sorting random numbers

I've been working on this elevator program for quite some time now and finally finished it and made it work and I'm pretty proud of myself, but I'd like to see ways how to optimize my code so I can ...
Med Amine Kortas's user avatar
6votes
1answer
1kviews

Sorting colors by the name of the color

I was in need to sort Colors, so the first thing that I tried was this: ...
Mak's user avatar
  • 61

153050per page
close